function getClass(parent,aE){
	var arr=[];
	var aResult=parent.getElementsByTagName('*');
	for(var i=0;i<aResult.length;i++){
		var bbb=aResult[i].className.split(' ');
		for(var j=0;j<bbb.length;j++){
			if(bbb[j]==aE){
			arr.push(aResult[i]);
			}
		}
		
	}
	return arr;
}
var oSection=document.getElementsByTagName('section')[0];
var oShop=document.getElementById('ul');
var oFor=document.getElementById('for');
var oEv=document.getElementById('evaluate');
var oA=oShop.getElementsByTagName('a');
oA[0].onclick=function(){
	for(var i=0;i<oA.length;i++){
		oA[i].className=''
	}
	this.className='active';
	oEv.style.display='none';
	
	oFor.style.display='block';
}
oA[1].onclick=function(){
	for(var i=0;i<oA.length;i++){
		oA[i].className=''
	}
	this.className='active';
	oFor.style.display='none';
	oEv.style.display='block';
}
oA[2].onclick=function(){
	for(var i=0;i<oA.length;i++){
		oA[i].className=''
	}
	this.className='active';
	oFor.style.display='none';
	
	oEv.style.display='block';
}

var oProduct=getClass(oSection,'productCar')[0];
var oShopcar=getClass(oProduct,'product-shopCar')[0];
var omoveUl=document.getElementById('moveul');
var oLi=omoveUl.getElementsByTagName('li');
var oBtnLeft=document.getElementById('left');
var oBtnRight=document.getElementById('right');
var num=0;
omoveUl.innerHTML+=omoveUl.innerHTML+omoveUl.innerHTML;
omoveUl.style.width=oLi[0].offsetWidth * oLi.length +'px';
var left=parseInt((omoveUl.offsetWidth)/3);
oBtnLeft.onclick=function(){
	num--;
	if(num<0){
		num=2;
	}
	startmove(omoveUl,{left:-left*num});
	
}
oBtnRight.onclick=function(){
	num++;
	if(num>2){
		num=0;
	}
	startmove(omoveUl,{left:-left*num});
}
function move(){
	num++;
	if(num>2){
		num=0;
	}
	startmove(omoveUl,{left:-left*num});
}
var timer=setInterval(move,3000);
oProduct.onmouseover=function(){
	clearInterval(timer);
}
oProduct.onmouseout=function(){
	timer=setInterval(move,3000);
}



	var oDiv=document.getElementById('div');
	var oMark=getClass(oDiv, 'mark')[0];
	var oFloat=getClass(oDiv, 'float_layer')[0];
	var oBig=getClass(oDiv, 'big_pic')[0];
	var oSmall=getClass(oDiv, 'small_pic')[0];
	var Img=oBig.getElementsByTagName('img')[0];
	
	oMark.onmouseover=function ()
	{
		oFloat.style.display='block';
		oBig.style.display='block';
	};
	
	oMark.onmouseout=function ()
	{
		oFloat.style.display='none';
		oBig.style.display='none';
	};
	
	oMark.onmousemove=function (ev)
	{
		var oEvent=ev||event;
		console.log(oEvent);
		var l=oEvent.pageX-oSection.offsetLeft-oDiv.offsetLeft-oSmall.offsetLeft-oFloat.offsetWidth/2;
		var t=oEvent.pageY-(oSection.offsetTop+25)-oDiv.offsetTop-oSmall.offsetTop-oFloat.offsetHeight/2;
		//console.log(l,t);
		if(l<0)
		{
			l=0;
		}
		else if(l>oMark.offsetWidth-oFloat.offsetWidth)
		{
			l=oMark.offsetWidth-oFloat.offsetWidth;
		}
		
		if(t<0)
		{
			t=0;
		}
		else if(t>oMark.offsetHeight-oFloat.offsetHeight)
		{
			t=oMark.offsetHeight-oFloat.offsetHeight;
		}
		
		oFloat.style.left=l+'px';
		oFloat.style.top=t+'px';
		
		var percentX=l/(oMark.offsetWidth-oFloat.offsetWidth);
		var percentY=t/(oMark.offsetHeight-oFloat.offsetHeight);
		
		Img.style.left=-percentX*(Img.offsetWidth-oBig.offsetWidth)+'px';
		Img.style.top=-percentY*(Img.offsetHeight-oBig.offsetHeight)+'px';
	};